package org.xm.sk.vo.tb;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.xm.sk.vo.Base;

import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
@Table(name = "dc_item")
@ApiModel(value = "Item", parent = Base.class, description = "项目")
public class Item extends Base {

    /**
     * 
     */
    private static final long serialVersionUID = -1365672336364180538L;

    @ApiModelProperty(value = "项目名称")
    @Column(length = 255)
    private String name;

    @ApiModelProperty(value = "项目下的订单")
    @JsonIgnore
    @ManyToMany(cascade = {
            CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "items")
    @Fetch(FetchMode.SUBSELECT)
    private Set<Boder> boders = new HashSet<Boder>(0);

    @ApiModelProperty(value = "项目对各个发型师的价格")
    @JsonIgnore
    @OneToMany(cascade = {
            CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "item")
    @Fetch(FetchMode.SUBSELECT)
    private Set<Price> prices = new HashSet<Price>(0);

    @ApiModelProperty(value = "描述项目的图片")
    @JsonIgnore
    @ManyToMany(cascade = {
            CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "items")
    @Fetch(FetchMode.SUBSELECT)
    private Set<Image> images = new HashSet<Image>(0);
    
    @ApiModelProperty(value = "项目适用的优惠活动")
    @JsonIgnore
    @ManyToMany(cascade = {
            CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "items")
    @Fetch(FetchMode.SUBSELECT)
    private Set<Activity> activitys = new HashSet<Activity>(0);
    
}
